home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STFLPTRN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  1.1 KB  |  35 lines

  1. #include <graphics.h>
  2. /* Define the fill style masks */
  3. unsigned char fillpattern[4][8] =
  4. {
  5. /* First mask */
  6.     1, 3, 7, 0xf, 0x1f, 0x3f, 0x7f, 0xff,
  7. /* Mask 2     */
  8.     0xf0, 0xf0, 0xf0, 0xf0, 0xf, 0xf, 0xf, 0xf,
  9. /* Mask 3     */
  10.     0xcc, 0x33, 0xcc, 0x33, 0xcc, 0x33, 0xcc, 0x33,
  11. /* Mask 4     */
  12.     0xc3, 0xc3, 0xc, 0xc, 0x30, 0x30, 0xc3, 0xc3
  13. };
  14. main()
  15. {
  16.    int graphdriver = DETECT;
  17.    int graphmode;
  18.    int i, x1=0, y1=40;
  19. /* Detect and initialize graphics system */
  20.    initgraph(&graphdriver, &graphmode, "c:\\turboc");
  21.    outtextxy(10,10, "Illstrating different fill styles:");
  22. /* Draw filled rectangle with different fill styles */
  23.    for (i=1; i<=2; i++)
  24.    {
  25.        setfillpattern(fillpattern[2*i-2], RED);
  26.        bar(x1, y1, x1+100, y1+60);
  27.        setfillpattern(fillpattern[2*i-1], YELLOW);
  28.        bar(x1+150, y1, x1+250, y1+60);
  29.        y1 += 100;
  30.    }
  31. /* Give user a chance to see the result */
  32.    outtextxy(getmaxx()/2, getmaxy() - 50, "Press any key to exit:");
  33.    getch();        /* Wait until a key is pressed */
  34.    closegraph();         /* Exit graphics library */
  35. }